<!DOCTYPE html>
<html>

<head>
  <title>stick 吸顶</title>
  <meta charset="UTF-8" />
  <style>
    .container {
      background: #eee;
    }

    .sticky-box {
      position: sticky;
      height: 60px;
      margin-bottom: 60px;
      background: cyan;
      top: 0;
    }

    .sticky-box:nth-child(odd){
      background: cornflowerblue;
    }

    div {
      font-size: 30px;
      text-align: center;
      color: #fff;
      line-height: 60px;
    }
  </style>
</head>

<body>
<div class="container">
  <div class="sticky-box">Header Section 001</div>
  <div class="sticky-box">Header Section 002</div>
  <div class="sticky-box">Header Section 003</div>
  <div class="sticky-box">Header Section 004</div>
  <div class="sticky-box">Header Section 005</div>
  <div class="sticky-box">Header Section 006</div>
  <div class="sticky-box">Header Section 007</div>
  <div class="sticky-box">Header Section 008</div>
  <div class="sticky-box">Header Section 009</div>
  <div class="sticky-box">Header Section 010</div>
  <div class="sticky-box">Header Section 011</div>
  <div class="sticky-box">Header Section 012</div>
  <div class="sticky-box">Header Section 013</div>
  <div class="sticky-box">Header Section 014</div>
  <div class="sticky-box">Header Section 015</div>
  <div class="sticky-box">Header Section 016</div>
  <div class="sticky-box">Header Section 017</div>
  <div class="sticky-box">Header Section 018</div>
  <div class="sticky-box">Header Section 019</div>
  <div class="sticky-box">Header Section 020</div>
</div>
</body>

</html>
